﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using AttributeRouting;
using AttributeRouting.Web.Mvc;
using Newtonsoft.Json.Linq;
using PH.Model.Results;
using PH.Model.Systems;
using PH.Logic.Systems;
namespace PH.Web.Management.Areas.Systems.Controllers
{
    [RouteArea("Systems")]
    [RoutePrefix("SysLog")]
    public class SysLogApiController : ApiController
    {
        [Route("Gets")]
        [HttpPost]
        public JsonEntitySet<SysLogModel> Gets(JObject request)
        {
            string errinfo = "no data";
            try
            {
                var sea = new Model.QueryBase();
                sea.PageSize = request.Value<int>("pageSize");
                sea.PageIndex = request.Value<int>("pageInde");
                var ret = SysLogLogic.Gets(sea);
                return new JsonEntitySet<SysLogModel>(ret);
            }
            catch (Exception ex)
            {
                errinfo = ex.Message;
                Common.Logger.Error("", ex);
            }
            return new JsonEntitySet<SysLogModel>(null, errinfo, false);
        }
    }
}
